<template>
  <div>
    <el-dialog
      :title="$t('intelligentQualityCheck.intelCarryOut')"
      :visible.sync="visible1"
      width="30%"
      :close-on-click-modal="false"
      @close="handleClose">
      <span class="rule">{{$t('intelligentQualityCheck.intelExecuteRule')}}:</span>
      <el-select size="mini" v-model.trim="Qctempletes" filterable multiple :placeholder="$t('public.pleasePick')">
        <el-option
          v-for="(item, index) in Qclists"
          :label="item.name"
          :value="item.value"
          :key="index"
        >
        </el-option>
      </el-select>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeQcDialog" class="primary_btn">{{$t('public.cancel')}}</el-button>
        <el-button type="primary" @click="comitQc" class="primary_btn">{{$t('public.confirm')}}</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
  export default {
    name: 'report',
    data () {
      return {
        Qctempletes: [],
        visible1: false
      }
    },
    props: {
      dialogVisible: Boolean,
      Qclists: Array
    },
    watch: {
      dialogVisible (cur) {
        this.visible1 = cur
        this.Qctempletes = []
      }
    },
    methods: {
      closeQcDialog () {
        this.$emit('closeQcDialog')
      },
      comitQc () {
        if (!this.Qctempletes.length) {
          this.$message.error(this.$t('intelligentQualityCheck.intelPleaChooseRule'))
          return
        }
        this.$emit('comitQc', this.Qctempletes)
      },
      handleClose () {
        this.$emit('closeQcDialog')
      }
    },
    beforeMount () {
    }
  }
</script>
<style lang="stylus" scoped>
@import "../../../../assets/common.styl"
  .el-select
    width 300px
    margin-left 10px
</style>
